import { Component, OnInit } from '@angular/core';
import {DictService} from "@shared/utils/dict.service";

@Component({
  selector: 'app-group-create-groupattr',
  templateUrl: './group-create-groupattr.component.html',
  styleUrls: ['./group-create-groupattr.component.css']
})
export class GroupCreateGroupattrComponent implements OnInit {
  public sex;
  public age ={max:'',min:''};
  public educational ='';//学历
  public customerlevel ='';//客户等级
  public risklevel =''//风险等级
  public customertype ='';//客户类型
  public aum ={max:'',min:''};
  public point ={max:'',min:''};

  constructor(public dictService: DictService) {}

  ngOnInit() {}
  handle($event){
  }
  submit() {
    let data = {'custAtrr':{}}
    if(this.sex!=''){
      data['custAtrr']['sex'] =this.sex
    }
    if(this.age['min']!==''&&this.age['max']!==''){
      data['custAtrr']['age'] ={max:parseInt(this.age.max),min:parseInt(this.age.min)}
    }
    if(this.educational!=''){
      data['custAtrr']['educational'] =this.educational
    }
    if(this.customerlevel!=''){
      data['custAtrr']['customerlevel'] =this.customerlevel
    }
    if(this.risklevel!=''){
      data['custAtrr']['risklevel'] =this.risklevel
    }
    if(this.customertype!=''){
      data['custAtrr']['customertype'] =this.customertype
    }
    if(this.aum['min']!==''&&this.aum['max']!==''){
      data['custAtrr']['aum'] ={max:parseInt(this.aum.max),min:parseInt(this.aum.min)}
    }
    if(this.point['min']!==''&&this.point['max']!==''){
      data['custAtrr']['point'] ={max:parseInt(this.point.max),min:parseInt(this.point.min)}
    }
    return data
  }

}
